<template>
  <div v-loading="loading" class="enterprise" style="width:100%">
    <div class="renzheng-label">
      <div>
        <span></span>
        <p>企业信息</p>
      </div>
    </div>
    <!-- 已认证 -->
    <div v-if="this.company.has_auth == '2'" class="renzheng-infos">
      <div class="renzheng-infos-con">
        <div class="infos-con-item">
          <div class="infos-con-item-l">账号</div>
          <div class="infos-con-item-r">
            <div>{{ company.account }}</div>
            <img style="margin-left: 5px" src="@/assets/images/console/renzheng.png" alt="" />
            <span style="color:#FFAC30">已认证</span>
          </div>
        </div>
        <div class="infos-con-item">
          <div class="infos-con-item-l">登录密码</div>
          <div class="infos-con-item-r">
            <div class="infos-con-item-r-text">
              <el-input :disabled="true" type="password" v-model="company.account" id="pas"> </el-input>
            </div>
            <div class="infos-con-item-r-button" @click="dialogFormVisible = true">更改</div>
          </div>
        </div>
        <div class="infos-con-item">
          <div class="infos-con-item-l">企业名称</div>
          <div class="infos-con-item-r">{{ companyList.company_name }}</div>
        </div>
        <div class="infos-con-item">
          <div class="infos-con-item-l">法定代表人姓名</div>
          <div class="infos-con-item-r">{{ companyList.legal_person }}</div>
        </div>
        <div class="infos-con-item" v-if="company.authentication_type == '1'">
          <div class="infos-con-item-l">经办人</div>
          <div class="infos-con-item-r">{{ companyList.charge_person_name }}</div>
        </div>
        <div class="infos-con-item">
          <div class="infos-con-item-l">企业邮箱</div>
          <div class="infos-con-item-r">
            <div class="infos-con-item-r-text">{{ company.email }}</div>
            <div class="infos-con-item-r-button" @click="dialogMail = true">更改</div>
          </div>
        </div>
        <div class="infos-con-item">
          <div class="infos-con-item-l">企业地址</div>
          <div class="infos-con-item-r">
            <div class="infos-con-item-r-text">
              <p style="color:#999999" v-show="!company.company_address">请手动添加</p>
              {{ company.company_address }}
            </div>
            <div class="infos-con-item-r-button" @click="dialogAddress = true">更改</div>
          </div>
        </div>
        <div class="infos-con-item">
          <div class="infos-con-item-l">注册时间</div>
          <div class="infos-con-item-r">{{ company.create_time }}</div>
        </div>
        <router-link class="renzheng-return" tag="div" to="/console/consoleHome">
          返回
        </router-link>
      </div>
    </div>
    <!-- 未认证 -->
    <div class="nrenzheng" v-else>
      <div class="nrenzheng-info">
        <div class="nrenzheng-form">
          <div class="form-list">
            <span class="list-babel">账号</span>
            <input type="text" class="texts" v-model="company.account" disabled="disabled" />
            <img src="@/assets/images/console/renzheng-grey.png" alt="" />
            <span v-show="company.has_auth == '0'">未认证</span>
            <span v-show="company.has_auth == '1'">待审核</span>
            <span v-show="company.has_auth == '2'">已认证</span>
            <span v-show="company.has_auth == '3'">认证失败</span>
          </div>
          <div class="form-list">
            <span class="list-babel">登录密码</span>
            <input type="password" v-model="company.account" disabled="disabled" />
            <span class="chang-pas" @click="dialogFormVisible = true">
              更改
            </span>
          </div>
          <div class="form-list">
            <span class="list-babel">注册时间</span>
            <input type="text" v-model="company.create_time" disabled="disabled" />
          </div>
        </div>
        <button class="go-renzheng" @click="clickRenzheng">
          立即认证
        </button>
      </div>
    </div>
    <!-- 更改密码的弹框 -->
    <el-dialog class="passGet" title="修改密码" :close-on-click-modal="false" :visible.sync="dialogFormVisible">
      <el-form :model="fromPass" ref="fromPass" :rules="rules">
        <el-form-item label="旧密码" prop="pass">
          <el-input v-model.lazy="fromPass.pass" show-password maxlength="22"></el-input>
        </el-form-item>
        <el-form-item label="新密码" prop="newpass">
          <el-input v-model.lazy="fromPass.newpass" show-password maxlength="22"></el-input>
        </el-form-item>
        <el-form-item label="确认新密码" prop="newpass1">
          <el-input v-model.lazy="fromPass.newpass1" show-password maxlength="22"></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogFormVisible = false">取 消</el-button>
        <el-button type="primary" @click="passClick('fromPass')">确 定</el-button>
      </div>
    </el-dialog>
    <!-- 认证的弹框  -->
    <el-dialog title="实名认证" :visible.sync="dialogRenzheng" :close="closeMy" id="approve" :close-on-click-modal="false" style="margin-top:-13vh">
      <div class="appropve-head">
        <div class="approveHeadButton" :class="{ active: islegalPerson }" @click="changeLegalPerson">我是法定代言人</div>
        <div class="approveHeadButton" :class="{ active: !islegalPerson }" @click="changeLegalPerson">我不是法定代言人</div>
      </div>
      <div class="approve-con">
        <!-- 法定代言人 -->
        <el-form :model="approveFrom" v-if="islegalPerson">
          <el-form-item label="按照要求上传营业执照" :required="true" class="license">
            <el-upload
              ref="uploadImg"
              class="upload-demo"
              :on-remove="handleRemove"
              list-type="picture-card"
              :limit="1"
              :action="this.httpUrl"
              accept="image/jpg,image/jpeg,image/png"
              :http-request="ImgClick"
              :before-upload="beforeUpload"
              id="license"
            >
              <img v-show="!approveFrom.yingye" src="@/assets/images/console/yy.png" class="yingye" />
              <el-button size="small" type="primary">上传</el-button>
              <div class="condition">只能上传jpg/png文件，且不超过500kb</div>
            </el-upload>
          </el-form-item>
          <el-form-item label="企业名称">
            <el-input v-model="approveFrom.company_name" autocomplete="off" validate-event placeholder="请输入企业名称"></el-input>
          </el-form-item>
          <el-form-item label="统一社会信用代码">
            <el-input v-model="approveFrom.credit_code" autocomplete="off" validate-event placeholder="请输入统一社会信用卡"></el-input>
          </el-form-item>
          <el-form-item label="法定代言人姓名">
            <el-input v-model="approveFrom.legal_person" autocomplete="off" validate-event placeholder="请输入法定代言人姓名"></el-input>
          </el-form-item>
          <el-form-item label="法定代言人身份证号">
            <el-input
              v-model="approveFrom.legal_person_code"
              autocomplete="off"
              maxlength="18"
              validate-event
              placeholder="请输入法定代言人身份证号"
            ></el-input>
          </el-form-item>
          <el-form-item label="上传法人证件照" id="identification">
            <el-upload
              ref="uploadImg"
              :action="this.httpUrl"
              :http-request="ImgClickCertificate"
              :show-file-list="false"
              class="avatar-uploader"
              :on-success="handleSuccessCertificate"
              :before-upload="beforeCertificate"
              accept="image/png,image/jpg,image/jpeg"
            >
              <img v-if="approveFrom.cardCertificate" :src="approveFrom.cardCertificate" class="avatar" />
              <div v-else>
                <img src="@/assets/images/console/scard.png" class="scard" />
                <p>上传手持证件照</p>
              </div>
            </el-upload>

            <el-upload
              ref="uploadImg"
              :action="this.httpUrl"
              :http-request="ImgClickFront"
              :show-file-list="false"
              class="avatar-uploader"
              :on-success="handleSuccessFront"
              :before-upload="beforeFront"
              accept="image/png,image/jpg,image/jpeg"
            >
              <img v-if="approveFrom.cardFront" :src="approveFrom.cardFront" class="avatar" />
              <div v-else>
                <img src="@/assets/images/console/identification.png" alt="" />
                <p>上传身份证人像面</p>
              </div>
            </el-upload>
            <el-upload
              ref="uploadImg"
              class="avatar-uploader"
              :action="this.httpUrl"
              :http-request="ImgClickReverse"
              :show-file-list="false"
              :on-success="handleSuccessReverse"
              :before-upload="beforeReverse"
              accept="image/png,image/jpg,image/jpeg"
            >
              <img v-if="approveFrom.cardReverse" :src="approveFrom.cardReverse" class="avatar" />
              <div v-else>
                <img src="@/assets/images/console/identification.png" alt="" />
                <p>上传身份证国徽面</p>
              </div>
            </el-upload>
          </el-form-item>
          <el-form-item label="法定代言人手机号">
            <el-input
              v-model="approveFrom.legal_person_phone"
              autocomplete="off"
              maxlength="11"
              validate-event
              placeholder="请输入上传法定代言人手机号"
            ></el-input>
          </el-form-item>
          <el-form-item label="短信验证码" :required="true" id="verification">
            <el-input v-model="approveFrom.code" autocomplete="off" validate-event placeholder="请输入短信验证码"></el-input>
            <div class="send" @click="getCode">{{ timeCode.txt }}</div>
          </el-form-item>
        </el-form>
        <!-- 不是代言人 -->
        <el-form :model="approveFromNo" v-else>
          <el-form-item label="按照要求上传营业执照" :required="true" class="license">
            <el-upload
              ref="uploadImg"
              class="upload-demo"
              :on-remove="handleRemoveNo"
              list-type="picture-card"
              :limit="1"
              :action="this.httpUrl"
              accept="image/jpg,image/jpeg,image/png"
              :http-request="ImgClickNo"
              :before-upload="beforeUploadNo"
              id="license"
            >
              <img v-show="!approveFromNo.yingye" src="@/assets/images/console/yy.png" class="yingye" />
              <el-button size="small" type="primary">上传</el-button>
              <div class="condition">只能上传jpg/png文件，且不超过500kb</div>
            </el-upload>
          </el-form-item>
          <el-form-item label="企业名称" :required="true">
            <el-input v-model="approveFromNo.company_name" autocomplete="off" validate-event placeholder="请输入企业名称"></el-input>
          </el-form-item>
          <el-form-item label="统一社会信用卡" :required="true">
            <el-input v-model="approveFromNo.credit_code" autocomplete="off" validate-event placeholder="请输入统一社会信用卡"></el-input>
          </el-form-item>
          <el-form-item label="法定代言人姓名" :required="true">
            <el-input v-model="approveFromNo.legal_person" autocomplete="off" validate-event placeholder="请输入法定代言人姓名"></el-input>
          </el-form-item>
          <el-form-item label="法定代言人身份证号" :required="true">
            <el-input
              v-model="approveFromNo.legal_person_code"
              autocomplete="off"
              maxlength="18"
              validate-event
              placeholder="请输入法定代言人身份证号"
            ></el-input>
          </el-form-item>
          <el-form-item label="上传法定代言人证件照" :required="true" id="identification">
            <el-upload
              ref="uploadImg"
              :action="this.httpUrl"
              :http-request="ImgClickFrontNo"
              :show-file-list="false"
              class="avatar-uploader"
              :on-success="handleSuccessFrontNo"
              :before-upload="beforeFrontNo"
              accept="image/png,image/jpg,image/jpeg"
            >
              <img v-if="approveFromNo.legal_cardFront" :src="approveFromNo.legal_cardFront" class="avatar" />
              <div v-else>
                <img src="@/assets/images/console/identification.png" alt="" />
                <p>上传身份证人像面</p>
              </div>
            </el-upload>
            <el-upload
              ref="uploadImg"
              class="avatar-uploader"
              :action="this.httpUrl"
              :http-request="ImgClickReverseNo"
              :show-file-list="false"
              :on-success="handleSuccessReverseNo"
              :before-upload="beforeReverseNo"
              accept="image/png,image/jpg,image/jpeg"
            >
              <img v-if="approveFromNo.legal_cardReverse" :src="approveFromNo.legal_cardReverse" class="avatar" />
              <div v-else>
                <img src="@/assets/images/console/identification.png" alt="" />
                <p>上传身份证国徽面</p>
              </div>
            </el-upload>
          </el-form-item>
          <el-form-item label="法定代言人手机号" :required="true">
            <el-input
              v-model="approveFromNo.legal_person_phone"
              autocomplete="off"
              maxlength="11"
              validate-event
              placeholder="请输入法定代言人手机号"
            ></el-input>
          </el-form-item>
          <el-form-item label="短信验证码" :required="true" id="verification">
            <el-input v-model="approveFromNo.legal_person_phone_code" autocomplete="off" validate-event placeholder="请输入短信验证码"></el-input>
            <div class="send" @click="getCodeNo">{{ timeCodeNo.txt }}</div>
          </el-form-item>
          <div class="dialog-admin">
            <div class="dialog-admin-title">
              <div>
                账号管理员信息
              </div>
            </div>
            <el-form-item label="账号管理员姓名" :required="true">
              <el-input v-model="approveFromNo.charge_person_name" autocomplete="off" validate-event placeholder="请输入账号管理员姓名"></el-input>
            </el-form-item>
            <el-form-item label="账号管理员身份证号" :required="true">
              <el-input
                v-model="approveFromNo.charge_person_code"
                autocomplete="off"
                maxlength="18"
                validate-event
                placeholder="请输入账号管理员身份证号"
              ></el-input>
            </el-form-item>
            <el-form-item label="账号管理员手机号" :required="true">
              <el-input
                v-model="approveFromNo.charge_person_phone"
                autocomplete="off"
                maxlength="11"
                validate-event
                placeholder="请输入账号管理员手机号"
              ></el-input>
            </el-form-item>
            <el-form-item label="短信验证码" :required="true" id="verification">
              <el-input v-model="approveFromNo.charge_person_phone_code" autocomplete="off" validate-event placeholder="请输入短信验证码"></el-input>
              <div class="send" @click="getCodeNo1">{{ timeCodeNo1.txt }}</div>
            </el-form-item>
            <el-form-item label="账号管理员证件照" :required="true" id="identification">
              <el-upload
                ref="uploadImg"
                :action="this.httpUrl"
                :http-request="ImgClickCertificateNo1"
                :show-file-list="false"
                class="avatar-uploader"
                :on-success="handleSuccessCertificateNo1"
                :before-upload="beforeCertificateNo1"
                accept="image/png,image/jpg,image/jpeg"
              >
                <img v-if="approveFromNo.charge_cardCertificate" :src="approveFrom.charge_cardCertificate" class="avatar" />
                <div v-else>
                  <img src="@/assets/images/console/scard.png" class="scard" />
                  <p>上传手持证件照</p>
                </div>
              </el-upload>

              <el-upload
                ref="uploadImg"
                :action="this.httpUrl"
                :http-request="ImgClickFrontNo1"
                :show-file-list="false"
                class="avatar-uploader"
                :on-success="handleSuccessFrontNo1"
                :before-upload="beforeFrontNo1"
                accept="image/png,image/jpg,image/jpeg"
              >
                <img v-if="approveFromNo.charge_cardFront" :src="approveFromNo.charge_cardFront" class="avatar" />
                <div v-else>
                  <img src="@/assets/images/console/identification.png" alt="" />
                  <p>上传身份证人像面</p>
                </div>
              </el-upload>
              <el-upload
                ref="uploadImg"
                class="avatar-uploader"
                :action="this.httpUrl"
                :http-request="ImgClickReverseNo1"
                :show-file-list="false"
                :on-success="handleSuccessReverseNo1"
                :before-upload="beforeReverseNo1"
                accept="image/png,image/jpg,image/jpeg"
              >
                <img v-if="approveFromNo.charge_cardReverse" :src="approveFromNo.charge_cardReverse" class="avatar" />
                <div v-else>
                  <img src="@/assets/images/console/identification.png" alt="" />
                  <p>上传身份证国徽面</p>
                </div>
              </el-upload>
            </el-form-item>
          </div>
        </el-form>
        <div class="agree">
          <div class="agree-icon" @click="changeAgree">
            <div v-if="agree" class="agrees">
              <i class="el-icon-check"></i>
            </div>
            <div v-else class="agrees"></div>
          </div>
          <div class="agree-text">我已阅读并同意<span style="color:#23B769">《认证协议》</span>，保证信息的真实性</div>
        </div>
      </div>
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogRenzheng = false">上一步</el-button>
        <el-button type="primary" v-show="islegalPerson" @click="Authentication(approveFrom)" :class="{ 'el-button-grey': !agree }">提交</el-button>
        <el-button type="primary" v-show="!islegalPerson" @click="AuthenticationNo(approveFromNo)" :class="{ 'el-button-grey': !agree }">提交</el-button>
      </div>
    </el-dialog>
    <!-- 更改企业邮箱的弹框 -->
    <el-dialog title="修改企业邮箱" class="passGet emailGet" :close-on-click-modal="false" :visible.sync="dialogMail">
      <el-form :model="fromEmail" :rules="rules" ref="fromEmail">
        <el-form-item label="旧邮箱" :label-width="formLabelWidth" prop="oldEmail">
          <el-input v-model="fromEmail.oldEmail" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="新邮箱" :label-width="formLabelWidth" prop="newEmail">
          <el-input v-model="fromEmail.newEmail" autocomplete="off"></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogMail = false">取 消</el-button>
        <el-button type="primary" @click="dialogEmail('fromEmail')">确 定</el-button>
      </div>
    </el-dialog>
    <!-- 更改企业地址的弹框 -->
    <el-dialog title="修改企业地址" class="passGet " :close-on-click-modal="false" :visible.sync="dialogAddress">
      <el-form :model="fromAddress" :rules="rules" ref="fromAddress">
        <el-form-item label="旧地址" :label-width="formLabelWidth" prop="oldAddress">
          <el-input v-model="fromAddress.oldAddress" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="新地址" :label-width="formLabelWidth" prop="oldAddress">
          <el-input v-model="fromAddress.newAddress" autocomplete="off"></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogAddress = false">取 消</el-button>
        <el-button type="primary" @click="dialogAddressGet('fromAddress')">确 定</el-button>
      </div>
    </el-dialog>
    <!-- 图形验证码的弹框 -->
    <el-dialog title="图形验证码" id="httpImg" :visible.sync="dialogImg" :close-on-click-modal="false" :modal-append-to-body="false">
      <img class="httpImg" @click="httpImgClick" :src="httpImg" alt="Img" />
      <el-form :rules="rules">
        <el-form-item label="">
          <el-input v-show="codeshow1" v-model="imgCode"></el-input>
          <el-input v-show="codeshow2" v-model="imgCodeNo"></el-input>
          <el-input v-show="codeshow3" v-model="imgCodeNo1"></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogImg = false" style="width:100px">取 消</el-button>
        <el-button type="primary" @click="dialogImgClick" style="width:100px;margin-left:30px">确 定</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { mapState } from 'vuex'
export default {
  name: 'Enterprise',
  data() {
    // 验证旧密码
    var validatepass = (rule, value, callback) => {
      // 验证密码
      const pass = /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{8,20}$/
      if (value === '') {
        callback(new Error('请输入密码'))
      } else if (!pass.test(value)) {
        callback(new Error('密码必须由数字和字母组成并不得小于8位！'))
      } else {
        callback()
      }
    }
    // 验证新密码
    var validatePassNew = (rule, value, callback) => {
      console.log(value)
      const pass = /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{8,20}$/
      if (value === '') {
        callback(new Error('请输入密码'))
      } else if (!pass.test(value)) {
        callback(new Error('密码必须由数字和字母组成并不得小于8位！'))
      } else {
        callback()
      }
    }
    // 验证再次输入的密码
    var validatePassNew1 = (rule, value, callback) => {
      console.log(value)
      console.log(this.fromPass.newpass)

      if (value === '') {
        callback(new Error('请再次输入密码'))
      } else if (value !== this.fromPass.newpass) {
        callback(new Error('两次密码不一致!'))
      } else {
        callback()
      }
    }
    // 验证邮箱
    var validateEmail = (rule, value, callback) => {
      const email = /^[A-Za-z0-9\u4e00-\u9fa5]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/

      if (value === '') {
        callback(new Error('请正确填写邮箱'))
      } else if (!email.test(value)) {
        callback(new Error('请输入有效的邮箱'))
      } else {
        this.timeCode.disabled = false
        callback()
      }
    }
    // 验证不为空
    var validateData = (rule, value, callback) => {
      if (value === '') {
        callback(new Error('请输入手机号或邮箱'))
      } else {
        callback()
      }
    }
    return {
      loading: true, // 加载动画
      islegalPerson: true,
      dialogMail: false, // 修改邮箱
      dialogAddress: false, // 修改地址
      dialogFormVisible: false, //修改密码时弹框的状态
      dialogAuthentication: false, //认证弹框的状态
      // 修改密码弹框
      fromPass: {
        pass: '',
        newpass: '',
        newpass1: ''
      },
      // 修改企业邮箱弹框
      fromEmail: {
        oldEmail: '',
        newEmail: ''
      },
      // 修改企业地址弹框
      fromAddress: {
        oldAddress: '',
        newAddress: ''
      },
      httpUrl: `http://192.168.2.174:8087/web/file/upload-file?access_token=${this.token}`, // 请求头
      //法人的信息
      approveFrom: {
        yingye: false, //营业执照
        code: '',
        company_license: '', // 上传营业执照返回的id
        company_name: '',
        credit_code: '',
        developer_id: '',
        hold_certificate: '',
        legal_person: '',
        legal_person_code: '',
        cardCertificate: '', // 身份证正面认证前默认图片
        cardFront: '', // 身份证正面认证前默认图片
        cardReverse: '', // 身份证手持图片
        legal_person_papers_front: '', // 上传身份证正面返回的id
        legal_person_papers_reverse: '', // 上传身份证反面返回的id
        legal_person_phone: ''
      },
      imgId: '',
      //非法人的信息
      approveFromNo: {
        legal_cardFront: '', // 法人身份证正面
        legal_cardReverse: '', // 法人身份证国辉面

        charge_cardCertificate: '', // 经办人手持身份证
        charge_cardFront: '', // 经办人身份证正面
        charge_cardReverse: '', // 法人身份证国辉面

        charge_person_code: '', // 经办人身份证号
        charge_person_hold_certificate: '', // 手持证件id
        charge_person_front: '', // 经办人身份证 正面id
        charge_person_reverse: '', // 经办人身份证 反面id
        charge_person_name: '',
        charge_person_phone: '',
        charge_person_phone_code: '',

        company_license: '', // 营业执照
        company_name: '',
        credit_code: '',
        developer_id: '', // 开发者标识
        legal_person: '',
        legal_person_code: '', // 法定代表人身份证号
        legal_person_papers_front: '', // 法定代表人 证件照 正面id
        legal_person_papers_reverse: '', // 法定代表人证件照反面id
        legal_person_phone: '',
        legal_person_phone_code: '',
        yingye: false //营业执照
      },
      formLabelWidth: '120px',
      agree: false,
      dialogRenzheng: false,
      // 密码校验
      rules: {
        pass: [{ validator: validatepass, trigger: 'blur' }],
        newpass: [{ validator: validatePassNew, trigger: 'blur' }],
        newpass1: [{ validator: validatePassNew1, trigger: 'blur' }],
        content: [{ validator: validateData, trigger: 'blur' }],
        oldEmail: [{ validator: validateEmail, trigger: 'blur' }],
        newEmail: [{ validator: validateEmail, trigger: 'blur' }],
        oldAddress: [{ validator: validateData, trigger: 'blur' }],
        newAddress: [{ validator: validateData, trigger: 'blur' }]
      },
      // 法人短信验证码
      timeCode: {
        txt: '获取验证码',
        time: 60,
        disabled: false
      },
      // 非法人短信验证码
      timeCodeNo: {
        txt: '获取验证码',
        time: 60,
        disabled: false
      },
      // 非法人邮箱验证码
      timeCodeNo1: {
        txt: '获取验证码',
        time: 60,
        disabled: false
      },
      // 图形弹框
      dialogImg: false,
      imgCode: '', // 法人的动态码
      imgCodeNo: '', // 非法人的手机动态码
      imgCodeNo1: '', // 非法人的邮箱动态码
      httpImg: '',
      codeshow1: false,
      codeshow2: false,
      codeshow3: false,
      // 企业信息
      company: {},
      // 认证成功后的企业信息
      companyList: {},
      companyDataList: [] // 传给首页的数据
    }
  },
  methods: {
    // 请求企业信息
    async companyData() {
      const appid = {
        developer_id: this.loginList.developer_id
      }
      const idx = JSON.stringify(appid)
      const data = await this.http.post(`/web/home/company/info?access_token=${this.token}`, idx)
      // console.log(data)
      this.loading = false
      if (data.result_code == '0') {
        this.company = data.data
        if (data.data.authentication_type == '0') {
          // 法人
          this.companyList = data.data.developer_legal_auth_res
        } else if (data.data.authentication_type == '1') {
          // 经办人
          this.companyList = data.data.developer_charge_auth_res
        }
        this.$store.commit('getCompanyList', data.data)
      }
      this.companyDataList.push(this.company)
      this.companyDataList.push(this.companyList)
      //this.$emit('getcompanyData', this.companyDataList)
    },
    // 企业密码修改
    passClick(formName) {
      this.$refs[formName].validate(valid => {
        if (valid) {
          const pass = {
            developer_id: this.loginList.developer_id,
            old_pwd: this.fromPass.pass,
            new_pwd: this.fromPass.newpass
          }
          const passList = JSON.stringify(pass)
          console.log(passList)
          this.http.post(`/web/login/modify-password?access_token=${this.loginList.token}`, passList).then(res => {
            console.log(res)
            if (res.result_code == '0') {
              this.$message({
                message: res.result_message,
                type: 'success'
              })
              this.dialogFormVisible = false
              this.companyData()
            } else if (res.result_code == '4003') {
              this.$message({
                message: res.result_message,
                type: 'error'
              })
            } else {
              this.$message({
                message: '密码修改失败！',
                type: 'error'
              })
            }
          })
        } else {
          console.log('error')
        }
      })
    },
    // 企业邮箱修改
    dialogEmail(formName) {
      this.$refs[formName].validate(valid => {
        if (valid) {
          console.log(valid)
          const pass = {
            developer_id: this.loginList.developer_id,
            account: this.fromEmail.newEmail
          }
          const passList = JSON.stringify(pass)
          console.log(passList)
          this.http.post(`/web/login/modify-account?access_token=${this.loginList.token}`, passList).then(res => {
            console.log(res)
            if (res.result_code == '0') {
              this.$message({
                message: res.result_message,
                type: 'success'
              })
              this.dialogMail = false
              this.companyData()
            } else if (res.result_code == '4003') {
              this.$message({
                message: res.result_message,
                type: 'error'
              })
            } else {
              this.$message({
                message: '邮箱修改失败！',
                type: 'error'
              })
            }
          })
        } else {
          console.log('error')
        }
      })
    },
    // 企业地址修改
    dialogAddressGet(formName) {
      this.$refs[formName].validate(valid => {
        if (valid) {
          console.log(valid)
          const pass = {
            developer_id: this.loginList.developer_id,
            company_address: this.fromAddress.newAddress
          }
          const passList = JSON.stringify(pass)
          console.log(passList)
          this.http.post(`/web/login/modify-address?access_token=${this.loginList.token}`, passList).then(res => {
            console.log(res)
            if (res.result_code == '0') {
              this.$message({
                message: res.result_message,
                type: 'success'
              })
              this.dialogAddress = false
              this.companyData()
            } else if (res.result_code == '4003') {
              this.$message({
                message: res.result_message,
                type: 'error'
              })
            } else {
              this.$message({
                message: '企业地址修改失败！',
                type: 'error'
              })
            }
          })
        } else {
          console.log('error')
        }
      })
    },
    // 打开认证弹框
    clickRenzheng() {
      if (this.loginList.has_auth == '0' || this.loginList.has_auth == '3') {
        this.dialogRenzheng = true
      } else {
        this.$message({
          message: '请勿重复认证！',
          type: 'error'
        })
      }
    },
    // 点击x关闭弹框
    closeMy() {
      this.$refs.uploadImg.clearFiles() // 清空图片
      this.approveFrom = {}
      this.approveFromNo = {}
    },
    //----------------------法人认证------------------
    // 上传营业执照
    handleRemove(file, fileList) {
      // 移除图片
      console.log(file, fileList)
    },
    beforeUpload(file) {
      this.approveFrom.yingye = true
      this.approveFromNo.yingye = true
      // 上传图片之前
      console.log(file)
      const isJPG = file.type
      const isLt2M = file.size / 1024 / 1024 < 2

      if (!isLt2M) {
        this.$message.error('上传头像图片大小不能超过 2MB!')
      }
      return isJPG && isLt2M
    },
    ImgClick(a) {
      this.loading = true
      const formdata = new FormData()
      formdata.append('file', a.file)
      formdata.append('type', '08') // 这是传的参数string格式
      this.axios
        .post(`/web/file/upload-file?access_token=${this.token}`, formdata, {
          headers: {
            'Content-Type': 'multipart/form-data'
          }
        })
        .then(res => {
          this.loading = false
          // console.log(res.data)
          if (res.data.result_code == '0') {
            this.approveFrom.company_license = res.data.data.id
            this.$message({
              message: '上传成功！',
              type: 'success'
            })
          } else {
            this.$message({
              message: '上传失败！',
              type: 'error'
            })
          }
        })
    },
    // 手持身份证
    beforeCertificate(file) {
      // 上传图片之前
      console.log(file)
      const isJPG = file.type
      const isLt2M = file.size / 1024 / 1024 < 2

      if (!isLt2M) {
        this.$message.error('上传头像图片大小不能超过 2MB!')
      }
      return isJPG && isLt2M
    },
    handleSuccessCertificate(file) {
      console.log(URL.createObjectURL(file.raw))
      this.approveFrom.cardCertificate = URL.createObjectURL(file.raw)
    },
    ImgClickCertificate(a) {
      const formdata = new FormData()
      formdata.append('file', a.file)
      formdata.append('type', '09') // 这是传的参数string格式
      this.axios
        .post(`/web/file/upload-file?access_token=${this.token}`, formdata, {
          headers: {
            'Content-Type': 'multipart/form-data'
          }
        })
        .then(res => {
          this.loading = false
          console.log(res.data)
          if (res.data.result_code == '0') {
            this.approveFrom.hold_certificate = res.data.data.id
            this.$message({
              message: '上传成功！',
              type: 'success'
            })
          } else {
            this.$message({
              message: '上传失败！',
              type: 'error'
            })
          }
        })
    },
    // 上传身份证正面照
    beforeFront(file) {
      // 上传图片之前
      console.log(file)
      const isJPG = file.type
      const isLt2M = file.size / 1024 / 1024 < 2

      if (!isLt2M) {
        this.$message.error('上传头像图片大小不能超过 2MB!')
      }
      return isJPG && isLt2M
    },
    handleSuccessFront(res, file) {
      console.log(URL.createObjectURL(file.raw))
      this.approveFrom.cardFront = URL.createObjectURL(file.raw)
    },
    ImgClickFront(a) {
      const formdata = new FormData()
      formdata.append('file', a.file)
      formdata.append('type', '09') // 这是传的参数string格式
      this.axios
        .post(`/web/file/upload-file?access_token=${this.token}`, formdata, {
          headers: {
            'Content-Type': 'multipart/form-data'
          }
        })
        .then(res => {
          this.loading = false
          console.log(res.data)
          if (res.data.result_code == '0') {
            this.approveFrom.legal_person_papers_front = res.data.data.id
            this.$message({
              message: '上传成功！',
              type: 'success'
            })
          } else {
            this.$message({
              message: '上传失败！',
              type: 'error'
            })
          }
        })
    },
    // 上传身份证国辉面照
    beforeReverse(file) {
      // 上传图片之前
      console.log(file)
      const isJPG = file.type
      const isLt2M = file.size / 1024 / 1024 < 2

      if (!isLt2M) {
        this.$message.error('上传头像图片大小不能超过 2MB!')
      }
      return isJPG && isLt2M
    },
    handleSuccessReverse(res, file) {
      console.log(URL.createObjectURL(file.raw))
      this.approveFrom.cardReverse = URL.createObjectURL(file.raw)
    },
    ImgClickReverse(a) {
      const formdata = new FormData()
      formdata.append('file', a.file)
      formdata.append('type', '09') // 这是传的参数string格式
      this.axios
        .post(`/web/file/upload-file?access_token=${this.token}`, formdata, {
          headers: {
            'Content-Type': 'multipart/form-data'
          }
        })
        .then(res => {
          this.loading = false
          console.log(res.data)
          if (res.data.result_code == '0') {
            this.approveFrom.legal_person_papers_reverse = res.data.data.id
            this.$message({
              message: '上传成功！',
              type: 'success'
            })
          } else {
            this.$message({
              message: '上传失败！',
              type: 'error'
            })
          }
        })
    },

    // 认证人提交
    async Authentication(e) {
      console.log(e)
      const auth = {
        code: e.code,
        company_license: e.company_license,
        company_name: e.company_name,
        credit_code: e.credit_code,
        developer_id: this.loginList.developer_id,
        hold_certificate: e.hold_certificate,
        legal_person: e.legal_person,
        legal_person_code: e.legal_person_code,
        legal_person_papers_front: e.legal_person_papers_front,
        legal_person_papers_reverse: e.legal_person_papers_reverse,
        legal_person_phone: e.legal_person_phone
      }
      const authList = JSON.stringify(auth)
      console.log(authList)
      const data = await this.http.post(`/web/developer/legal-auth?access_token=${this.loginList.token}`, authList)
      console.log(data)
      if (data.result_code == '0') {
        this.$message({
          message: data.result_message,
          type: 'success'
        })
        console.log(data.data)
        this.dialogRenzheng = false
        this.$refs.uploadImg.clearFiles() // 清空图片
        this.approveFrom = {}
        this.companyData() // 请求企业信息
      } else {
        this.$message({
          message: data.result_message,
          type: 'error'
        })
      }
    },
    //----------------------非法人认证------------------
    // 上传营业执照
    handleRemoveNo(file, fileList) {
      // 移除图片
      console.log(file, fileList)
    },
    beforeUploadNo(file) {
      this.approveFrom.yingye = true
      this.approveFromNo.yingye = true
      // 上传图片之前
      console.log(file)
      const isJPG = file.type
      const isLt2M = file.size / 1024 / 1024 < 2

      if (!isLt2M) {
        this.$message.error('上传头像图片大小不能超过 2MB!')
      }
      return isJPG && isLt2M
    },
    ImgClickNo(a) {
      this.loading = true
      const formdata = new FormData()
      formdata.append('file', a.file)
      formdata.append('type', '08') // 这是传的参数string格式
      this.axios
        .post(`/web/file/upload-file?access_token=${this.token}`, formdata, {
          headers: {
            'Content-Type': 'multipart/form-data'
          }
        })
        .then(res => {
          this.loading = false
          // console.log(res.data)
          if (res.data.result_code == '0') {
            this.approveFromNo.company_license = res.data.data.id
            this.$message({
              message: '上传成功！',
              type: 'success'
            })
          } else {
            this.$message({
              message: '上传失败！',
              type: 'error'
            })
          }
        })
    },
    // 非法人上传身份证正面照
    beforeFrontNo(file) {
      // 上传图片之前
      console.log(file)
      const isJPG = file.type
      const isLt2M = file.size / 1024 / 1024 < 2

      if (!isLt2M) {
        this.$message.error('上传头像图片大小不能超过 2MB!')
      }
      return isJPG && isLt2M
    },
    handleSuccessFrontNo(res, file) {
      console.log(URL.createObjectURL(file.raw))
      this.approveFrom.legal_cardFront = URL.createObjectURL(file.raw)
    },
    ImgClickFrontNo(a) {
      const formdata = new FormData()
      formdata.append('file', a.file)
      formdata.append('type', '09') // 这是传的参数string格式
      this.axios
        .post(`/web/file/upload-file?access_token=${this.token}`, formdata, {
          headers: {
            'Content-Type': 'multipart/form-data'
          }
        })
        .then(res => {
          this.loading = false
          console.log(res.data)
          if (res.data.result_code == '0') {
            this.approveFromNo.legal_person_papers_front = res.data.data.id
            this.$message({
              message: '上传成功！',
              type: 'success'
            })
          } else {
            this.$message({
              message: '上传失败！',
              type: 'error'
            })
          }
        })
    },
    // 非法人上传身份证国辉面照
    beforeReverseNo(file) {
      // 上传图片之前
      console.log(file)
      const isJPG = file.type
      const isLt2M = file.size / 1024 / 1024 < 2

      if (!isLt2M) {
        this.$message.error('上传头像图片大小不能超过 2MB!')
      }
      return isJPG && isLt2M
    },
    handleSuccessReverseNo(res, file) {
      console.log(URL.createObjectURL(file.raw))
      this.approveFrom.legal_cardReverse = URL.createObjectURL(file.raw)
    },
    ImgClickReverseNo(a) {
      const formdata = new FormData()
      formdata.append('file', a.file)
      formdata.append('type', '09') // 这是传的参数string格式
      this.axios
        .post(`/web/file/upload-file?access_token=${this.token}`, formdata, {
          headers: {
            'Content-Type': 'multipart/form-data'
          }
        })
        .then(res => {
          this.loading = false
          console.log(res.data)
          if (res.data.result_code == '0') {
            this.approveFromNo.legal_person_papers_reverse = res.data.data.id
            this.$message({
              message: '上传成功！',
              type: 'success'
            })
          } else {
            this.$message({
              message: '上传失败！',
              type: 'error'
            })
          }
        })
    },
    // 经办人手持身份证
    beforeCertificateNo1(file) {
      // 上传图片之前
      console.log(file)
      const isJPG = file.type
      const isLt2M = file.size / 1024 / 1024 < 2

      if (!isLt2M) {
        this.$message.error('上传头像图片大小不能超过 2MB!')
      }
      return isJPG && isLt2M
    },
    handleSuccessCertificateNo1(res, file) {
      console.log(URL.createObjectURL(file.raw))
      this.approveFrom.charge_cardCertificate = URL.createObjectURL(file.raw)
    },
    ImgClickCertificateNo1(a) {
      const formdata = new FormData()
      formdata.append('file', a.file)
      formdata.append('type', '09') // 这是传的参数string格式
      this.axios
        .post(`/web/file/upload-file?access_token=${this.token}`, formdata, {
          headers: {
            'Content-Type': 'multipart/form-data'
          }
        })
        .then(res => {
          this.loading = false
          console.log(res.data)
          if (res.data.result_code == '0') {
            this.approveFromNo.charge_person_hold_certificate = res.data.data.id
            this.$message({
              message: '上传成功！',
              type: 'success'
            })
          } else {
            this.$message({
              message: '上传失败！',
              type: 'error'
            })
          }
        })
    },
    // 经办人上传身份证正面照
    beforeFrontNo1(file) {
      // 上传图片之前
      console.log(file)
      const isJPG = file.type
      const isLt2M = file.size / 1024 / 1024 < 2

      if (!isLt2M) {
        this.$message.error('上传头像图片大小不能超过 2MB!')
      }
      return isJPG && isLt2M
    },
    handleSuccessFrontNo1(res, file) {
      console.log(URL.createObjectURL(file.raw))
      this.approveFrom.charge_cardFront = URL.createObjectURL(file.raw)
    },
    ImgClickFrontNo1(a) {
      const formdata = new FormData()
      formdata.append('file', a.file)
      formdata.append('type', '09') // 这是传的参数string格式
      this.axios
        .post(`/web/file/upload-file?access_token=${this.token}`, formdata, {
          headers: {
            'Content-Type': 'multipart/form-data'
          }
        })
        .then(res => {
          this.loading = false
          console.log(res.data)
          if (res.data.result_code == '0') {
            this.approveFromNo.charge_person_front = res.data.data.id
            this.$message({
              message: '上传成功！',
              type: 'success'
            })
          } else {
            this.$message({
              message: '上传失败！',
              type: 'error'
            })
          }
        })
    },
    // 经办人上传身份证国辉面照
    beforeReverseNo1(file) {
      // 上传图片之前
      console.log(file)
      const isJPG = file.type
      const isLt2M = file.size / 1024 / 1024 < 2

      if (!isLt2M) {
        this.$message.error('上传头像图片大小不能超过 2MB!')
      }
      return isJPG && isLt2M
    },
    handleSuccessReverseNo1(res, file) {
      console.log(URL.createObjectURL(file.raw))
      this.approveFrom.charge_cardReverse = URL.createObjectURL(file.raw)
    },
    ImgClickReverseNo1(a) {
      const formdata = new FormData()
      formdata.append('file', a.file)
      formdata.append('type', '09') // 这是传的参数string格式
      this.axios
        .post(`/web/file/upload-file?access_token=${this.token}`, formdata, {
          headers: {
            'Content-Type': 'multipart/form-data'
          }
        })
        .then(res => {
          this.loading = false
          console.log(res.data)
          if (res.data.result_code == '0') {
            this.approveFromNo.charge_person_reverse = res.data.data.id
            this.$message({
              message: '上传成功！',
              type: 'success'
            })
          } else {
            this.$message({
              message: '上传失败！',
              type: 'error'
            })
          }
        })
    },
    // 非认证人提交
    async AuthenticationNo(e) {
      console.log(e)
      const auth = {
        developer_id: this.loginList.developer_id,
        charge_person_code: e.charge_person_code,
        charge_person_front: e.charge_person_front,
        charge_person_hold_certificate: e.charge_person_hold_certificate,
        charge_person_name: e.charge_person_name,
        charge_person_phone: e.charge_person_phone,
        charge_person_phone_code: e.charge_person_phone_code,
        charge_person_reverse: e.charge_person_reverse,
        company_license: e.company_license,
        company_name: e.company_name,
        credit_code: e.credit_code,
        legal_person: e.legal_person,
        legal_person_code: e.legal_person_code,
        legal_person_papers_front: e.legal_person_papers_front,
        legal_person_papers_reverse: e.legal_person_papers_reverse,
        legal_person_phone: e.legal_person_phone,
        legal_person_phone_code: e.legal_person_phone_code
      }
      const authList = JSON.stringify(auth)
      console.log(authList)
      const data = await this.http.post(`/web/developer/charge-auth?access_token=${this.loginList.token}`, authList)
      console.log(data)
      if (data.result_code == '0') {
        this.$message({
          message: data.result_message,
          type: 'success'
        })
        console.log(data.data)
        this.dialogRenzheng = false
        this.approveFromNo = {}
        this.$refs.uploadImg.clearFiles() // 清空图片
        this.companyData() // 请求企业信息
      } else {
        this.$message({
          message: data.result_message,
          type: 'error'
        })
      }
    },
    // ---------------------------验证码-------------
    // 法人点击获取验证码
    async getCode() {
      var str = /^1[3456789]\d{9}$/
      if (this.approveFrom.legal_person_phone == '') {
        // 验证码发送消息提示
        this.$message({
          message: '手机号不能为空',
          type: 'error'
        })
        return false
      } else if (!str.test(this.approveFrom.legal_person_phone)) {
        // 验证码发送消息提示
        this.$message({
          message: '请正确填写手机号！',
          type: 'error'
        })
        return false
      } else {
        this.codeshow1 = true
        this.codeshow2 = false
        this.codeshow3 = false
        // 先获取图形验证码
        this.dialogImg = true
        const num = Math.ceil(Math.random() * 100)
        // 图片流转base64
        const data = await this.http.get(`/web/login/get-captcha?${num}`, { responseType: 'arraybuffer' })
        console.log(data)
        this.httpImg = 'data:image/png;base64,' + btoa(new Uint8Array(data).reduce((data, byte) => data + String.fromCharCode(byte), ''))
      }
    },
    // 非法人认证点击手机获取验证码
    async getCodeNo() {
      var str = /^1[3456789]\d{9}$/
      if (this.approveFromNo.legal_person_phone == '') {
        // 验证码发送消息提示
        this.$message({
          message: '手机号不能为空',
          type: 'error'
        })
        return false
      } else if (!str.test(this.approveFromNo.legal_person_phone)) {
        // 验证码发送消息提示
        this.$message({
          message: '请正确填写手机号！',
          type: 'error'
        })
        return false
      } else {
        console.log(3333)
        this.codeshow1 = false
        this.codeshow2 = true
        this.codeshow3 = false
        // 先获取图形验证码
        this.dialogImg = true
        const num = Math.ceil(Math.random() * 100)
        // 图片流转base64
        const data = await this.http.get(`/web/login/get-captcha?${num}`, { responseType: 'arraybuffer' })
        console.log(data)
        this.httpImg = 'data:image/png;base64,' + btoa(new Uint8Array(data).reduce((data, byte) => data + String.fromCharCode(byte), ''))
      }
    },
    // 非经办人认证点击手机获取验证码
    async getCodeNo1() {
      var str = /^1[3456789]\d{9}$/
      if (this.approveFromNo.charge_person_phone == '') {
        // 验证码发送消息提示
        this.$message({
          message: '手机号不能为空',
          type: 'error'
        })
        return false
      } else if (!str.test(this.approveFromNo.charge_person_phone)) {
        // 验证码发送消息提示
        this.$message({
          message: '请正确填写手机号！',
          type: 'error'
        })
        return false
      } else {
        this.codeshow1 = false
        this.codeshow2 = false
        this.codeshow3 = true
        // 先获取图形验证码
        this.dialogImg = true
        const num = Math.ceil(Math.random() * 100)
        // 图片流转base64
        const data = await this.http.get(`/web/login/get-captcha?${num}`, { responseType: 'arraybuffer' })
        console.log(data)
        this.httpImg = 'data:image/png;base64,' + btoa(new Uint8Array(data).reduce((data, byte) => data + String.fromCharCode(byte), ''))
      }
    },
    // 法人倒计时
    timeCodes() {
      // 验证码倒计时
      if (this.timeCode.time > 0) {
        this.timeCode.disabled = true
        this.timeCode.txt = this.timeCode.time + 's'
        this.timeCode.time--
      } else {
        this.timeCode.disabled = false
        this.timeCode.txt = '重新获取'
        this.timeCode.time = 60
        return
      }
      setTimeout(() => {
        this.timeCodes()
      }, 1000)
    },
    // 非法人倒计时
    timeCodesNo() {
      // 验证码倒计时
      if (this.timeCodeNo.time > 0) {
        this.timeCodeNo.disabled = true
        this.timeCodeNo.txt = this.timeCodeNo.time + 's'
        this.timeCodeNo.time--
      } else {
        this.timeCodeNo.disabled = false
        this.timeCodeNo.txt = '重新获取'
        this.timeCodeNo.time = 60
        return
      }
      setTimeout(() => {
        this.timeCodesNo()
      }, 1000)
    },
    // 非法人经办人倒计时
    timeCodesNo1() {
      // 验证码倒计时
      if (this.timeCodeNo1.time > 0) {
        this.timeCodeNo1.disabled = true
        this.timeCodeNo1.txt = this.timeCodeNo1.time + 's'
        this.timeCodeNo1.time--
      } else {
        this.timeCodeNo1.disabled = false
        this.timeCodeNo1.txt = '重新获取'
        this.timeCodeNo1.time = 60
        return
      }
      setTimeout(() => {
        this.timeCodesNo1()
      }, 1000)
    },
    // 点击刷新图形验证码(用随机数触发)
    async httpImgClick() {
      const num = Math.ceil(Math.random() * 100)
      const data = await this.http.get(`/web/login/get-captcha?${num}`, { responseType: 'arraybuffer' })
      this.httpImg = 'data:image/png;base64,' + btoa(new Uint8Array(data).reduce((data, byte) => data + String.fromCharCode(byte), ''))
    },
    // 获取验证码 法人 和非法人
    async dialogImgClick() {
      if (this.imgCode) {
        console.log(this.httpImg)
        const codes = {
          account: this.approveFrom.legal_person_phone,
          send_code_type: 2,
          graph_code: this.imgCode
        }
        const codeList = JSON.stringify(codes)
        const data = await this.http.post('/web/login/send-code', codeList)
        if (data.result_code == '0') {
          this.imgCode = '' // 清空验证码
          this.dialogImg = false
          this.$message({
            message: '验证码发送成功！',
            type: 'success'
          })
          // 获取验证码
          this.timeCodes()
        } else {
          this.$message({
            message: data.result_message,
            type: 'error'
          })
          const num = Math.ceil(Math.random() * 100)
          const datas = await this.http.get(`/web/login/get-captcha?${num}`, { responseType: 'arraybuffer' })
          this.httpImg = 'data:image/png;base64,' + btoa(new Uint8Array(datas).reduce((data, byte) => data + String.fromCharCode(byte), ''))
        }
      } else if (this.imgCodeNo) {
        const codes = {
          account: this.approveFromNo.legal_person_phone,
          send_code_type: 2,
          graph_code: this.imgCodeNo
        }
        const codeList = JSON.stringify(codes)
        console.log(codeList)
        const data = await this.http.post('/web/login/send-code', codeList)
        if (data.result_code == '0') {
          this.imgCodeNo = '' // 清空验证码框
          this.dialogImg = false
          this.$message({
            message: '验证码发送成功！',
            type: 'success'
          })
          // 获取验证码
          this.timeCodesNo()
        } else {
          this.$message({
            message: data.result_message,
            type: 'error'
          })
          const num = Math.ceil(Math.random() * 100)
          const datas = await this.http.get(`/web/login/get-captcha?${num}`, { responseType: 'arraybuffer' })
          this.httpImg = 'data:image/png;base64,' + btoa(new Uint8Array(datas).reduce((data, byte) => data + String.fromCharCode(byte), ''))
        }
      } else if (this.imgCodeNo1) {
        const codes = {
          account: this.approveFromNo.charge_person_phone,
          send_code_type: 3,
          graph_code: this.imgCodeNo1
        }
        const codeList = JSON.stringify(codes)
        const data = await this.http.post('/web/login/send-code', codeList)
        if (data.result_code == '0') {
          this.imgCodeNo1 = '' // 清空验证码框
          this.dialogImg = false
          this.$message({
            message: '验证码发送成功！',
            type: 'success'
          })
          // 获取验证码
          this.timeCodesNo1()
        } else {
          this.$message({
            message: data.result_message,
            type: 'error'
          })
          const num = Math.ceil(Math.random() * 100)
          const datas = await this.http.get(`/web/login/get-captcha?${num}`, { responseType: 'arraybuffer' })
          this.httpImg = 'data:image/png;base64,' + btoa(new Uint8Array(datas).reduce((data, byte) => data + String.fromCharCode(byte), ''))
        }
      }
    },

    changeAgree() {
      this.agree = !this.agree
    },
    changeLegalPerson() {
      this.islegalPerson = !this.islegalPerson
      this.agree = false
    },
    changeShowInfo() {
      this.isShowInfo = true
    }
  },
  computed: {
    ...mapState({
      loginList: modules => modules.login.loginList,
      token: modules => modules.login.loginList.token
    })
  },
  created() {
    this.companyData() // 请求企业信息
  }
}
</script>

<style lang="scss" scoped>
/deep/.el-input__inner {
  padding: 0;
}
.enterprise {
  width: 100%;
  height: 79vh;
  .renzheng-label {
    width: 100%;
    height: 70px;
    padding: 30px 50px 20px 45px;
    background-color: #fff;
    div {
      display: flex;
      padding-bottom: 1px;
      padding-bottom: 18px;
      border-bottom: 1px solid #f0f0f0;
      span {
        display: block;
        width: 2px;
        height: 20px;
        background: rgba(35, 183, 105, 1);
        margin-right: 12px;
      }
      p {
        width: 86px;
        font-size: 20px;
        font-family: NotoSansHans-Regular, NotoSansHans;
        font-weight: 400;
        letter-spacing: 1px;
      }
    }
  }
  // 未认证
  .nrenzheng {
    width: 100%;
    height: 100%;
    background-color: #fff;
    .nrenzheng-info {
      padding-top: 112px;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-direction: column;
      .nrenzheng-form {
        .form-list {
          margin-bottom: 20px;
          display: flex;
          align-items: center;
          .list-babel {
            display: block;
            width: 80px;
            text-align: right;
            font-size: 18px;
            color: rgba(153, 153, 153, 1);
            letter-spacing: 1px;
            margin-right: 49px;
          }
          input {
            border: none;
            font-size: 18px;
            color: rgba(51, 51, 51, 1);
            letter-spacing: 1px;
            background-color: #fff;
            margin-right: 10px;
          }
          span:nth-child(4) {
            color: rgba(204, 204, 204, 1);
            margin-left: 4px;
          }
          span.chang-pas {
            width: 70px;
            height: 28px;
            border-radius: 6px;
            border: 1px solid rgba(35, 183, 105, 1);
            font-size: 18px;
            color: rgba(35, 183, 105, 1);
            letter-spacing: 1px;
            line-height: 28px;
            text-align: center;
            cursor: pointer;
          }
        }
      }
      .go-renzheng {
        margin-top: 120px;
        width: 200px;
        height: 40px;
        background: rgba(35, 183, 105, 1);
        border-radius: 6px;
        font-size: 18px;
        color: rgba(255, 255, 255, 1);
        letter-spacing: 1px;
        line-height: 40px;
        text-align: center;
        cursor: pointer;
      }
    }
  }
  // 已认证
  .renzheng-infos {
    width: 100%;
    height: 100%;
    background-color: #fff;
    .renzheng-infos-con {
      width: 50%;
      height: 100%;
      margin: 0 auto;
      padding-top: 3%;
      .infos-con-item {
        display: flex;
        align-items: center;
        margin-bottom: 40px;
        justify-content: space-between;
        .infos-con-item-l {
          width: 35%;
          overflow: hidden;
          text-overflow: ellipsis;
          white-space: nowrap;
          text-align: right;
          font-size: 18px;
          font-weight: 400;
          color: rgba(153, 153, 153, 1);
          letter-spacing: 1px;
        }
        .infos-con-item-r {
          width: 60%;
          display: flex;
          align-items: center;
          font-size: 18px;
          font-weight: 400;
          color: rgba(51, 51, 51, 1);
          letter-spacing: 1px;
          overflow: hidden;
          text-overflow: ellipsis;
          white-space: nowrap;
          /deep/ .el-input #pas {
            border: none;
            background-color: #fff;
            font-size: 18px;
            font-weight: 400;
            color: #333333;
            letter-spacing: 1px;
          }
          .infos-con-item-r-button,
          .infos-con-item-r-img {
            margin-left: 40px;
          }
          .infos-con-item-r-button {
            width: 70px;
            height: 28px;
            border-radius: 6px;
            border: 1px solid rgba(35, 183, 105, 1);
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 18px;
            font-weight: 400;
            color: rgba(35, 183, 105, 1);
            letter-spacing: 1px;
            cursor: pointer;
          }
        }
      }
      .renzheng-return {
        width: 135px;
        margin: 50px auto;
        height: 40px;
        background: rgba(35, 183, 105, 1);
        border-radius: 6px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 18px;
        font-weight: 400;
        color: rgba(255, 255, 255, 1);
        letter-spacing: 1px;
        cursor: pointer;
      }
    }
  }
}
/deep/.infos-con-item {
  .el-input input {
    padding-left: 0;
  }
}
// 认证的弹框
/deep/.el-input input {
  padding-left: 20px;
}
/deep/#approve {
  // margin-top: -10vh;
  .el-dialog__body {
    padding-bottom: 0;
  }
  //上传用户证件照
  .avatar-uploader {
    margin-right: 6%;
    .el-upload {
      width: 130px;
      height: 90px;
      background: rgba(240, 240, 240, 1);
      border-radius: 6px;
      img.avatar {
        width: 100%;
        height: 100%;
      }
    }
  }

  .el-dialog {
    box-sizing: border-box;
    width: 55%;
    height: 82%;
    overflow-y: scroll;
  }

  //发送验证码的样式
  #verification {
    display: flex;
    align-items: center;
    .el-form-item__content {
      display: flex;
      align-items: center;
      width: 75%;
      .el-input {
        width: 55%;
      }
      .send {
        width: 20%;
        margin-left: 2%;
        border-radius: 6px;
        border: 1px solid rgba(35, 183, 105, 1);
        font-size: 0.18em;
        color: rgba(35, 183, 105, 1);
        letter-spacing: 1px;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
      }
    }
  }
  #identification {
    display: flex;
    align-items: center;
    .el-form-item__content {
      display: flex;
      align-items: center;
      height: auto;
      line-height: normal;

      .el-upload--text > div {
        padding-top: 5px;
        p {
          height: auto;
          line-height: normal;
        }
        img {
          height: auto;
          line-height: normal;
        }
      }
    }
  }

  //滚动条的样式
  .scrollbar {
    width: 30px;
    height: 300px;
    margin: 0 auto;
  }
  .el-dialog::-webkit-scrollbar {
    /*滚动条整体样式*/
    width: 3px; /*高宽分别对应横竖滚动条的尺寸*/
    height: 1px;
  }
  .el-dialog::-webkit-scrollbar-thumb {
    /*滚动条里面小方块*/
    border-radius: 10px;
    background-color: skyblue;
    background-image: -webkit-linear-gradient(
      45deg,
      rgba(255, 255, 255, 0.2) 25%,
      transparent 25%,
      transparent 50%,
      rgba(255, 255, 255, 0.2) 50%,
      rgba(255, 255, 255, 0.2) 75%,
      transparent 75%,
      transparent
    );
  }
  .el-dialog::-webkit-scrollbar-track {
    /*滚动条里面轨道*/
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    background: #ededed;
  }

  .el-form {
    padding-top: 30px;
    padding-left: 17%;
  }
  .el-dialog__header {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px 0;
    box-sizing: border-box;
  }
  .el-dialog__footer {
    padding-top: 20px;
    box-sizing: border-box;
    padding-bottom: 50px;
    text-align: center;
    .el-button {
      width: 184px;
      height: 42px;
      background: rgba(35, 183, 105, 1);
      border-radius: 8px;
      border: none;
      color: #fff;
      font-size: 18px;

      color: rgba(255, 255, 255, 1);

      letter-spacing: 1px;
    }
    .el-button-grey {
      background: rgba(35, 183, 105, 0.5);
    }
  }
  .license {
    display: flex;
    align-items: center;
    .el-form-item__content {
      display: flex;
      #license {
        width: 100%;
        display: flex;
        justify-content: space-between;
        box-sizing: border-box;
        .el-upload-list__item {
          width: 65px;
          height: 90px;
          img {
            width: 100%;
            height: 100%;
          }
        }
        .el-upload-list--picture-card {
          display: flex;
          align-items: center;
        }
        .el-upload--picture-card {
          line-height: normal;
          height: auto;
          box-sizing: border-box;
          padding: 14px 0;
          padding-left: 60px;
          width: 90%;
          border: none;
          background-color: #fff;
          display: flex;
          flex-direction: column;
          justify-content: center;
          .el-button--primary {
            width: 71px;
            height: 28px;
            background: rgba(35, 183, 105, 1);
            border-radius: 6px;
            display: flex;
            align-items: center;
            justify-content: center;
          }
          .condition {
            width: 100%;
            height: 20%;
            line-height: 20px;
            font-size: 12px;
            color: rgba(153, 153, 153, 1);
            margin-top: 20px;
            text-align: left;
          }
        }
      }
    }
  }
  .el-form-item__label {
    padding-right: 30px;
  }
  .el-input {
    width: 60%;
  }

  // 账号管理员信息
  .dialog-admin {
    .dialog-admin-title {
      margin: 60px 0 40px;
      div {
        width: 90%;
        margin-left: -4%;
        text-align: center;
        font-size: 18px;
        font-weight: 500;
        color: rgba(51, 51, 51, 1);
        letter-spacing: 1px;
        padding-bottom: 20px;
        border-bottom: 1px solid #d8d8d8;

        font-family: NotoSansHans-Medium, NotoSansHans;
      }
    }
  }
  //同意认证协议
  .agree {
    display: flex;
    align-items: center;
    padding-left: 30%;
    .agree-icon {
      margin-right: 20px;
      .agrees {
        width: 18px;
        height: 18px;
        border: 1px solid rgba(216, 216, 216, 1);
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        i {
          color: rgb(35, 183, 105);
          font-size: 18px;
          font-weight: 600;
        }
      }
    }
  }
}

// 认证弹框的上传营业执照的样式
/deep/.license {
  .el-form-item__content {
    display: flex;
    #license {
      width: 75%;
      box-sizing: border-box;
    }
  }
}
// 上传营业执照
.yingye {
  position: absolute;
  left: 0;
  width: auto;
}
// 身份证示例
.scard {
  margin-right: 6%;
  width: 60%;
}
// 上传营业执照按钮
/deep/.el-button--small,
.el-button--small.is-round {
  padding: 2px;
}
// 图形验证码
#httpImg {
  .httpImg {
    width: 160px;
    margin-bottom: 10px;
    cursor: pointer;
  }
  /deep/.el-dialog {
    text-align: center;
    width: 30%;
    .el-dialog__body {
      padding: 20px 100px 0;
      .el-input__inner {
        text-align: center;
      }
    }
    .el-button--default:hover {
      background: #fff;
      color: #23b769;
      border: 1px solid #23b769;
    }
    .el-button--primary:focus,
    .el-button--primary:hover {
      background: #23b769;
      color: #ffffff;
    }
    .el-button--default:focus,
    .el-button--default:hover {
      border: 1px solid #23b769;
      color: #23b769;
      background: #fff;
    }
    .el-dialog__footer {
      text-align: center;
    }
  }
}
// 更改密码弹框
/deep/.passGet {
  .el-dialog {
    width: 30%;
    .el-dialog__title {
      color: #666;
    }
    .el-form-item__label {
      width: 23%;
      margin-right: 10%;
      text-align: right;
    }
    .el-input {
      width: 60%;
    }
    .el-form-item__error {
      width: 260px;
      left: 35%;
    }
    .el-dialog__footer {
      text-align: center;
      .el-button--primary {
        margin-left: 10%;
      }
      .el-button--primary:hover,
      .el-button--primary:focus {
        background: #23b769;
      }
      .el-button--default:focus,
      .el-button--default:hover {
        border: 1px solid #23b769;
        color: #23b769;
        background: #fff;
      }
    }
  }
}
// 更改企业邮箱
/deep/.emailGet {
  .el-dialog {
    .el-form-item__error {
      left: 13% !important;
    }
  }
}
</style>
